from modelscope.models import Model
from modelscope.exporters import Exporter
import sys
import os
import re
import codecs
import json
from typing import List, Dict, Tuple, Set, Union, Any, Optional
# main func()
if __name__ == '__main__':
    model_id = 'damo/nlp_structbert_sentence-similarity_chinese-base'
    # model_id = 'damo/speech_paraformer_asr-en-16k-vocab4199-pytorch'
    model_id = sys.argv[1] if len(sys.argv) > 1 else model_id
    model = Model.from_pretrained(model_id)
    curdir = os.getcwd()
    output_files = Exporter.from_model(
        model).export_onnx(opset=13, output_dir=curdir)
    print(output_files)
